package com.example.storage.controller;


import com.example.storage.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 库存服务
 */
@RestController
public class StorageRestController {

    @Autowired
    StorageService storageService;

    /**
     * 扣减库存
     *
     * @param commodityCode
     * @param count
     * @return
     */
    @GetMapping("/deduct")
    public String deduct(@RequestParam("commodityCode") String commodityCode,
                         @RequestParam("count") Integer count) {
        storageService.deduct(commodityCode, count);
        return "storage deduct success";
    }

}
